var t = require;
var e = module;
var o = exports;
var n =
    (this && this.__extends) ||
    (function() {
        var t = function(e, o) {
            return (t =
                Object.setPrototypeOf ||
                ({ __proto__: [] }
                    instanceof Array &&
                    function(t, e) {
                        t.__proto__ = e;
                    }) ||
                function(t, e) {
                    for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                })(e, o);
        };
        return function(e, o) {
            function n() {
                this.constructor = e;
            }
            t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
        };
    })(),
    r =
    (this && this.__decorate) ||
    function(t, e, o, n) {
        var r,
            a = arguments.length,
            i = a < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n);
        else
            for (var s = t.length - 1; s >= 0; s--)
                (r = t[s]) && (i = (a < 3 ? r(i) : a > 3 ? r(e, o, i) : r(e, o)) || i);
        return a > 3 && i && Object.defineProperty(e, o, i), i;
    };
Object.defineProperty(o, "__esModule", { value: !0 });
var a = t("BootConst"),
    i = t("EventData"),
    s = t("GameData"),
    c = t("SpriteLoad"),
    l = t("Util"),
    u = t("View"),
    p = t("Prefabs"),
    f = t("WatchVideo"),
    d = t("ConfS"),
    h = t("fightManager"),
    y = t("fightView"),
    g = t("fun"),
    v = t("selectfuben"),
    m = t("warehouse"),
    _ = require("./关卡推荐等级提示"),
    A = require("./关卡详情Item"),
    b = cc._decorator,
    C = b.ccclass,
    w =
    (b.property,
        (function(t) {
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                return (
                    (e.res = "关卡详情"),
                    (e.isMask = !0),
                    (e.zIndex = 2),
                    (e.data = new i.default(h.default.fubendata)),
                    e
                );
            }
            return (
                n(e, t),
                (e.prototype.view_所有敌人 = function(t, e) {
                    t.content.destroyAllChildren(),
                        e.xinguai.forEach(function(e) {
                            var o = d.DatasManager.HeroDatasById[e],
                                n = p.instantiate("SpriteLoad");
                            (n.parent = t.content), (n.getComponent(c.default).url.value = o.iconName);
                        });
                }),
                (e.prototype.view_敌人数量 = function(t, e) {
                    t.string = "敌人数量: " + e.guding.length;
                }),
                (e.prototype.view_所有怪兽 = function(t, e) {
                    var o = this.find("item");
                    d.DatasManager.HeroDatas.forEach(function(e, n) {
                        var r = t.content.children[n];
                        null == r && (((r = cc.instantiate(o)).active = !0), (r.parent = t.content)),
                            r.getComponent(A.default).set(e);
                    });
                    var n = d.DatasManager.HeroDatasById[s.default.hero],
                        r = d.DatasManager.HeroDatas.indexOf(n),
                        a = d.DatasManager.HeroDatas.length - 1;
                    t.scrollTo(cc.v2(r / a, 0), 0.1);
                }),
                (e.prototype.onClick = function(t, e) {
                    var o = this;
                    switch (t) {
                        case "close":
                            this.hideView();
                            break;
                        case "item":
                            s.default.heros.includes(e) ?
                                (s.default.hero != e && (s.default.hero = e),
                                    (h.default.playerdata = {
                                        herodata: d.DatasManager.HeroDatasById[s.default.hero],
                                        herolvs: s.default.herolvs,
                                        equips: s.default.equips
                                    })) :
                                f.default.show(a.dd.tryHero, function() {
                                    var t = 1;
                                    s.default.heros.forEach(function(e) {
                                        var o = g.getHeroLv(e);
                                        t < o && (t = o);
                                    });
                                    var n = {};
                                    (n[e] = t),
                                    (h.default.playerdata = {
                                        herodata: d.DatasManager.HeroDatasById[e],
                                        herolvs: n,
                                        equips: d.DatasManager.HeroDatasById[e].equipids
                                    }),
                                    o.hideView(),
                                        o.hideView(v.default),
                                        o.showView(y.default);
                                });
                            break;
                        case "开始战斗":
                            if (null == d.DatasManager.HeroDatasById[s.default.hero])
                                return void l.toast("请选择一个怪兽");
                            (h.default.playerdata = {
                                herodata: d.DatasManager.HeroDatasById[s.default.hero],
                                herolvs: s.default.herolvs,
                                equips: s.default.equips
                            }),
                            g.getHeroLv(s.default.hero) >= h.default.fubendata.SuggestLv ?
                                (this.hideView(), this.hideView(v.default), this.showView(y.default)) :
                                (this.showView(_.default).set(
                                    this,
                                    function() {
                                        o.hideView(), o.hideView(v.default), o.showView(y.default);
                                    },
                                    function() {
                                        o.hideView(), o.hideView(v.default), o.showView(m.default);
                                    }
                                ).lv.value = h.default.fubendata.SuggestLv);
                    }
                }),
                (e = r([C], e))
            );
        })(u.default));
o.default = w;